package exam.nio.T2;

import java.util.*;

public class Main {

    public static int n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i=0; i<n; ++i) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(solution(a, b));
        }
    }

    private static int solution(int a, int b) {
        return a * b + b;
    }
}